<template>
	<view>
		<!-- 企业信息 -->
		<view style="padding-bottom: 20rpx;" v-if="current==1">


			<view class="view_top">
				<text>{{obj.archiveName}}</text>
				<view class="view_content">
					<view class="view_left">

						<view class="text_view1">
							<text style="color:#A7A7A7;font-size: 50rpx;font-weight: 700;">{{obj.score}}</text>
							<text style="font-size: 32rpx;">上限100</text>
						</view>

						<view class="text_view1">
							<text>评估发布时间</text>
							<text>{{obj.releaseTime}}</text>
						</view>
						<view class="text_view1">
							<text>评估期</text>
							<text>{{obj.evalSection}}</text>
						</view>

					</view>
					<view class="view_right">
						<canvas class="uqrcode" canvas-id="uqrcode"></canvas>
						<view style="text-align: center;width: 70px;font-size: 28rpx;line-height: 20px;">
							<text style="color: #A7A7A7;">已过期</text>
						</view>
					</view>
				</view>

			</view>

			<view class="viewpage">
				<!-- <text>安庆市正华危险品运输有限公司</text> -->
				<v-table :columns="columns" :list="data"></v-table>
			</view>

		</view>


	</view>

</template>

<script>
	import {
		archiveItem
	} from '@/common/api/req.js'
	import vTable from '../msgQuery/components/table-list.vue'
	import uQRCode from '@/common/uqrcode.js' //引入uqrcode.js
	import {
		dateFormat
	} from "@/common/util.js"
	export default {
		components: {
			vTable
		},
		data() {
			return {
				current: 1,
				data: [],
				listData: [],
				columns: [{
						title: "序号",
						type: 'index',
						$width: '2em',

					},
					{
						title: '指标项',
						key: 'indicatorItem',
						$width: '100px'
					},

					{
						title: '描述',
						key: 'indicatorDesc',
						// $width: '160px'
					},
					{
						title: '得分/上限值',
						key: 'itemScore',
						$width: '70px',
						format: ({
							item
						}) => {
							return `<span style="color:#297EFD;">${item.itemScore}</span>/${item.standardScore}`;
						}
					}
				],
				obj: {},

			};
		},
		onLoad(option) {
			this.obj = JSON.parse(option.item)
		},
		mounted() {
			const qrData = {
				// uid: this.listData.idCard,
				id: this.obj.id,
				// archiveCode: this.obj.archiveCode,
				// archiveName: this.obj.archiveName,
				evalSection: this.obj.evalSection,
				levels: this.obj.levels,
				score: this.obj.score,
				datetime: dateFormat(),
			}
			// this.uqrCodeType = this.getScoreType(qrData.score)
			this.qrFun(JSON.stringify(qrData)); //调用生成二维码方法
			archiveItem({
				archiveId: this.obj.archiveId,
				evalSection: this.obj.evalSection, //评估周期
			}).then(res => {
				console.log(res);
				this.data = res.data.data.assArchiveDetailList
			})
		},
		methods: {
			// 监听点击右上角事件
			onNavigationBarButtonTap(e) {
				this.$goBack('../msgQuery/integral_rule?type=2', 2);
			},
			tabChange(e) {
				if (e == 0) {
					this.$goBack('../msgQuery/score_details', 2);
				} else {
					this.current = e;
				}
			},
			qrFun(text) {
				uQRCode.make({
					canvasId: 'uqrcode',
					componentInstance: this,
					text: text,
					size: 70,
					margin: 0,
					backgroundColor: '#ffffff',
					foregroundColor: '#A7A7A7',
					fileType: 'jpg',
					errorCorrectLevel: uQRCode.errorCorrectLevel.H,
					success: res => {
						// console.log(res);
					},
				})
			},

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #EFEFEF;
	}

	.uqrcode {
		width: 70px !important;
		height: 70px !important;
	}

	.topview {
		padding: 10px 15px;
		background-color: #fff;


		.u-subsection--subsection {
			// border-radius: 20rpx;
			// border: 2rpx #1590EF solid;
		}

	}

	.view_top {
		display: flex;

		flex-direction: column;
		background-color: #ffffff;
		padding: 20rpx;
		margin: 20rpx 0px;

		text {
			margin: 0 auto;
		}

		.view_content {
			display: flex;

			.view_left {
				flex: 2;
				display: flex;
				flex-direction: column;
				border-right: 2rpx #1590EF solid;

				.text_view1 {
					display: flex;
					align-items: center;

					text {
						flex: 2;
						font-size: 26rpx;
						color: #A7A7A7;

						&:nth-child(2) {
							flex: 3
						}
					}
				}
			}

			.view_right {
				width: 80px;
				height: 180rpx;
				padding: 0 0 0 10px;
			}
		}

	}

	.viewpage {
		background-color: #ffffff;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		display: flex;
		justify-content: center;

		text {
			font-size: 34rpx;
		}
	}



	.list_item {
		border-radius: 10px;
		background-color: #FFFFFF;
		margin: 10px 20px 0 20px;
		padding-bottom: 5px;



		.item_top {
			display: flex;
			justify-content: space-between;
			height: 80rpx;
			border-radius: 10rpx;

			.view_pai {
				padding-left: 30rpx;
				height: 40rpx;
				margin-top: 30rpx;
				display: flex;
				align-items: center;

				.text_pai {
					font-size: 28rpx;
					font-weight: 700;
				}
			}

			.view_state {
				height: 50rpx;
				border-top-right-radius: 10rpx;
				border-bottom-left-radius: 8rpx;
				padding-left: 5rpx;
				padding-right: 5rpx;
				background-color: #666666;
				display: flex;
				align-items: center;

				.text_state {
					font-size: 28rpx;
					font-weight: 700;
				}
			}

		}

		.item_line {
			height: 1rpx;
			background-color: #F2F2F2;
			margin-left: 35rpx;
			margin-right: 35rpx;
		}

		.item_center {
			display: flex;
			flex-direction: column;
			padding-left: 35rpx;
			padding-top: 20rpx;
			padding-bottom: 10rpx;

			.center_top {
				display: flex;
				height: 50rpx;
				align-items: center;

				.view_jia {
					width: 45rpx;
					height: 45rpx;
					background-color: #4CAF50;
					border-radius: 45rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						color: #FFFFFF;
						font-size: 20rpx;
						font-weight: 700;
					}
				}

				.view_ya {
					width: 45rpx;
					height: 45rpx;
					background-color: #2196F3;
					border-radius: 45rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						color: #FFFFFF;
						font-size: 20rpx;
						font-weight: 700;
					}
				}

				.text_name {
					margin-left: 20rpx;
					font-size: 28rpx;
					font-weight: 700;
				}

				.text_phone {
					margin-left: 30rpx;
					font-size: 28rpx;
					font-weight: 700;
					color: #666666;
				}
			}

			.center_line {
				margin-left: 22rpx;
				height: 15rpx;
				width: 5rpx;
				background-color: #000000;
			}

		}

		.item_bottom {
			display: flex;
			flex-direction: column;
			padding-left: 35rpx;
			padding-top: 10px;

			.bottom_text {
				display: flex;
				align-items: center;
				padding-top: 10rpx;
				padding-bottom: 10rpx;

				.text_left {
					font-size: 30rpx;
					color: #666666;
					width: 120px;
				}

				.stars {
					width: 30rpx;
					height: 30rpx;
					margin-left: 20rpx;
				}

				.text_right1 {
					// flex: 1;
					font-size: 30rpx;
					display: inline-block;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				.text_right {
					flex: 1;
					font-size: 30rpx;
					display: inline-block;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				.progress_view {
					flex: 1;
					display: flex;
					padding-right: 30rpx;

					text {
						margin: 0 auto;
					}

					.stars_view {
						display: flex;
						justify-content: center;
						flex-direction: column;
						margin-left: 1rpx;
						margin-right: 1rpx;

						.stars_line1 {
							background-color: #178FFD;
							height: 5rpx;
							width: 100%;
						}

						.stars_line2 {
							background-color: #DB972D;
							height: 5rpx;
							width: 100%;
						}

						.stars_line3 {
							background-color: #25C9B1;
							height: 5rpx;
							width: 100%;
						}
					}
				}

			}
		}
	}
</style>
